<!--
	作者：2575202388@qq.com
	时间：2018-10-19
	描述：公用级联删除组件
-->
<template>
	<div>
		<Cascader trigger="hover" transfer v-model="selects" @on-change="selectedxzqy" :render-format="renderformat" :data="xzqh" style="width:100%;" :size="size"></Cascader>
	</div>
</template>

<script>
	export default {
		name: "Tcascader",
		props: {
			size: {
				type: String
			},
			xzqhvalue: {
				type: String,
				default: ""
			}
		},
		model: {
			prop: "xzqhvalue",
		},
		data() {
			return {
				selects: []
			}
		},
		methods: {
			selectedxzqy(value, selectedData) {
				this.selects = value;
				this.$emit("on-change", value.join(","), selectedData);
			},
			renderformat(labels) {
				const index = labels.length - 1;
				return labels[index];
			}
		},
		mounted() {

		},
		watch: {
			xzqhvalue(news, olds) {
				if(news) {
					this.selects = news.split(",");
				} else {
					this.selects = [];
				}
			}
		},
		computed: {
			xzqh: function() {
				return this.$store.state.app.xzqh;
			}
		}
	}
</script>

<style>

</style>